package org.base.common.pojo;
import lombok.Data;
import org.base.common.exception.ExceptionEnum;

@Data
public class Result {

    private Integer status;
    private String msg;
    private Object data;

    public Result(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public Result(Object data) {
        this.status = ExceptionEnum.OK.getStatus();
        this.data = data;
    }

    public Result() {

    }

    public static Result error(ExceptionEnum exceptionEnum) {
        final Result result = new Result();
        result.setStatus(exceptionEnum.getStatus());
        result.setMsg(exceptionEnum.getMsg());
        return result;
    }

}
